home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 003 / books.arc / CURREPT.PRG < prev    next >
Text File  |  1985-04-18  |  3KB  |  118 lines

  1. * Currept.prg
  2. * Print report of current transactions
  3.  
  4. * First get Company name fro geninfo
  5. use geninfo
  6. store company to company
  7.  
  8. * Get info on dates, and store
  9. * to search macro (cond)
  10. erase
  11. store ' ' to yn
  12. @ 5,2 say 'Transaction for this month only? ' get yn pict "!"
  13. read
  14.  
  15. * Set up search condition
  16. * according to user's request.
  17. if !(YN) = "Y"
  18.    store "date = '"+$(t:date,1,2)+"'" to cond
  19.    store f to range
  20. else
  21.    store "        " to start,finish
  22.    @ 7,2 SAY "Enter starting date " get start pict "99/99/99"
  23.    @ 9,2 say "Enter ending date " get finish pict "99/99/99"
  24.    read
  25.    store "date >= start .and. date <= finish" to cond
  26.    store t to range
  27. endi (yn = y)
  28.  
  29. * next, get sort order
  30. erase
  31. stor 0 to schoice
  32. @ 3,10 say "Sort Orders"
  33. @ 5, 8 say "1. By Account Number"
  34. @ 6, 8 say "2. By Date"
  35. @ 8, 8 say "Enter choice (1-2) " get schoice pict "9"
  36. read
  37.  
  38. * Set up sort order and report type.
  39. if schoice = 2
  40.    use trans index dates
  41.    stor "DATES" to roption
  42. else
  43.    use trans index acct
  44.    stor "ACCTS" to roption
  45. endif
  46.  
  47. * ask about printer
  48. erase
  49. store ' ' to yn
  50. @ 5,2 say "Send Report to printer? " get yn pict "!"
  51. read
  52. * and set on if necessary
  53. if yn = "Y"
  54.    set print on
  55. endif (yn = y)
  56.  
  57. * mark subaccounts for report.
  58. repl noupdate all marker with " "
  59. repl noupdate all marker with "*";
  60.      for acct <> int(acct)
  61.  
  62. * Calculate Totals, Leaving out subaccounts.
  63. sum amount for acct<300 .and. &cond .and.;
  64.     int(acct)=acct to income
  65. sum amount for acct>=300 .and. &cond .and.;
  66.     int(acct)=acct to expenses
  67.  
  68. * print the report using
  69. * predefined report formats
  70. set eject off
  71. erase
  72. ? "              Income Statement for &company"
  73. ?
  74. * Print appropriate subheading
  75. if range
  76.    ? "For transactions from &start to &finish
  77. else
  78.    ? "For &t:date"
  79. endif (range)
  80. * Print income transactions
  81. ?
  82. ? "INCOME:"
  83. repo form &roption for acct<300 .and. &cond plain
  84. ? "Total Income                          "+;
  85.    str(income,10,2)
  86. ?
  87. * print expenses transactions
  88. ? "EXPENSES:"
  89. repo form &roption for acct>=300 .and. &cond plain
  90. ? "Total Expenses                        "+;
  91.    str(expenses,10,2)
  92. * display Balance at bottom of sheet
  93. ?
  94. ? "Total Income                          "+;
  95.    str(Income,10,2)
  96. ? "Total Expenses                        "+;
  97.    str(expenses,10,2)
  98. ? "                                        ---------"
  99. ? "Balance                               "+;
  100.    str(Income - expenses,10,2)
  101. ?
  102. ? " NOTE: Subaccounts marked with a *"
  103. ?? "are noy included in totals."
  104. eject
  105. set print off
  106. * If report not going to printer
  107. * pause on screen
  108. if !(YN) <> "Y"
  109.    ?
  110.    ?
  111.    ? "Press any key to continue"
  112.    wait
  113. endif (YN=Y)
  114.  
  115. release company,yn,cond,start,finish,range
  116. release schoice,roption,income,expense
  117. return
  118.